package kr.saeildamil.androidstudy_second.cp;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class WordDBHelper extends SQLiteOpenHelper {
	final static String TAG = "WordDBHelper";
	
	public WordDBHelper(Context context) {
		super(context, "EngWord.db", null, 3);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		String sql = "CREATE TABLE dic ( " + 
					 "_id INTEGER PRIMARY KEY AUTOINCREMENT," +
					 "Eng Text, " +
					 "han Text" +
					 ");";
		db.execSQL(sql);
	}
	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		Log.d(TAG, "onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)");
		String sql = "DROP TABLE IF EXISTS dic";
		db.execSQL(sql);
		onCreate(db);
	}
}
